home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20020314-20021006 / 000251_Use-Author-Add…-Header@[127.1]_Wed Jul 31 09:54:24 EDT 2002.msg < prev    next >
Text File  |  2020-01-01  |  14KB  |  392 lines

  1. Article: 13566 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!newsfeed.nyu.edu!newsfeed.mathworks.com!oleane.net!oleane!esplande3000.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!newsrouter.chello.at!newsfeed.Austria.EU.net!newsfeed.kpnqwest.at!anon.lcs.mit.edu!nym.alias.net!mail2news
  3. Subject: Case Study: Lynx/Kermit Coordination (Part II)
  4. Message-ID: <E17ZruT-0005z1-00@dxmcgyver>
  5. From: "Dallas E. Legan" <Use-Author-Address-Header@[127.1]>
  6. Author-Address: dallasii <AT> kincyb <DOT> com
  7. Date: Wed, 31 Jul 2002 04:44:57 -0700
  8. Mail-To-News-Contact: postmaster@nym.alias.net
  9. Organization: mail2news@nym.alias.net
  10. Newsgroups: comp.protocols.kermit.misc
  11. Lines: 378
  12. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13566
  13.  
  14.  
  15. Case Study: Lynx/Kermit Coordination (Part II) - Kermit Finds Jobs
  16.  
  17. ****************************************************************************
  18. Note: This article is not intended either to endorse or disparage
  19. http://www.dice.com, but simply to describe the author's use of the service.
  20. ****************************************************************************
  21.  
  22. I had one of the leaders of the local USENIX chapter
  23. review my resume for suggested changes and he urged me
  24. to check for jobs on www.dice.com.
  25.  
  26. At first I looked at Dice a little, somewhat discouraged by 
  27. previous experiences with online job boards.  Then I had the
  28. idea of automating the process of sending resumes to
  29. the finds that came up, and really get after things.
  30. Sophisticated time/motion studies weren't needed to 
  31. realize that only 3 or 4 keystrokes were needed to navigate
  32. >from  one search find to another.  In vi cursor control mode
  33. these were barely more than finger twitches.
  34. To actually send information to to the firm in question though,
  35. chewed up several times that many keystrokes and constituted the 
  36. real bottleneck in using the service.  Just see the commented-out
  37. 'mailto:' sequence for Lynx in the script below.
  38. Then there were editor commands to read in a resume.
  39.  
  40. One thing I noticed was that the 'mailto:' links were not
  41. truly 'mailto:'s.  While displaying as mail addresses,
  42. in fact they were http:...cgi?...  style links apparently
  43. doing some things in the background.  What I didn't exactly know.
  44. Trying to go to one directly from a command line
  45. invocation of the browsers I have seemed to paralyze the
  46. browser.
  47.  
  48. The first stab at this was a Rexx script (using the Regina
  49. GPL'd interpreter) to be run as a Lynx Extern program,
  50. (see http://www.columbia.edu/kermit/case20.html, Part I of this series.)
  51. tearing apart the CGI URL and mailing a resume to the
  52. firm listing the position.
  53. (See the comments in the listing below.)
  54. The reason for picking this language was that
  55. it seemed like a simple minded use of the Rexx Parse command.
  56. I tried running this a few days on what turned up,
  57. but the mailings seemed to do nothing whatever.
  58. Maybe something important was going on with the
  59. CGI script at the server? 
  60.  
  61. The next try at this would use the actual http URL
  62. going through the whole process of punching in the
  63. browser questions for sending mail.
  64. Working on this a Friday afternoon,
  65. I would run Lynx inside a C-Kermit pseudoterminal session,
  66. (C-Kermit 8.0.200, 12 Dec 2001, running on Debian Linux 2.2)
  67. and rough out the first version of a script that would
  68. set and react when Kermit detected a 'trigger string'
  69. in the browsing session.
  70. In this first version, I would activate the 'mail' CGI link,
  71. and and the trigger string 'Using mailto:' would show up
  72. on the Lynx advanced user mode status line.
  73. At this point the C-Kermit script would take over,
  74. making sure my name was correctly entered,
  75. adding some to the subject line,
  76. erasing my address from the 'Cc:' option,
  77. and then reading in my resume to the vi edit session
  78. my Lynx configuration was set up to use for editing tasks.
  79. To my delight it worked!
  80. Being encouraged, sometime that afternoon, I decided to go for broke.
  81. I brought up the Dice.com advanced query page,
  82. set it to hunt for jobs in the last 30 days,
  83. 50 hits per page, first 2000 hits, for the keyword
  84. 'Perl', hit the 'search' link and 1,399 finds popped up.
  85. 1,399, a number I will never forget.  :-)
  86. I proceeded plowing away.
  87.  
  88. At Dice 'perl' hit 700, I disconnected my dialup connection,
  89. leaving the browser on the page left off at,
  90. and went to pick up a couple of newspapers, my mail,
  91. get a meal, and some of my daily reading.
  92.  
  93. Returning, I decided to make an improvement
  94. to the script, so that I didn't have to manually 
  95. activate the 'mailto:' CGI link.
  96. Instead, I used part of the CGI link URL, which would show
  97. up on the Lynx status line, as the trigger string,
  98. so that all I had to do was move the browser cursor
  99. over the link, and then C-Kermit would take over
  100. and send the e-mail.  
  101. A little bit of experimentation was needed for this,
  102. documented in the commented-out tries.
  103. With this change, I pushed ahead until
  104. finishing all of the finds, sometime Saturday morning.
  105.  
  106. The script below is presented warts and all, only
  107. with some email addresses mangled to prevent 
  108. their being spam targets,
  109. and comments added later denoted with '# *'.
  110. Typically, you might start the session with:
  111.  
  112. pty lynx -your -choice -of -switches -here   http://www.dice.com
  113.  
  114. at the Kermit command line and you will be put in interactive
  115. mode with Lynx.
  116. There was an accompanying macro,
  117.  
  118. define dicecgi  take  /home..../dicedgi.ksc
  119.  
  120. to get it started with the script.  
  121. This could be put in the Kermit startup files.
  122. >From  the interactive Lynx session, hit 'C-\ c' to
  123. return to the Kermit command line and use the macro
  124. 'dicecgi', instead of the usual 'connect' command to
  125. go interactive with browsing again.
  126. The script might be made a bit cleaner using the '/trigger:'
  127. switch on the 'connect' command, instead of setting it
  128. with 'set terminal ...'.
  129. As it is, the string is cleared as soon as it triggers
  130. return from the connect session, and not reset until
  131. Lynx is moved to the end of the page before reconnecting.
  132. All of this to avoid going into an infinite loop
  133. if it returned directly to the page as it was before triggering,
  134. where the same string would still be on the status line.
  135. There are probably many parallels with the handling of 
  136. interrupts and signals.
  137. One obvious improvement would be to have it
  138. bookmark the links it processes, so a 
  139. log of what was done could easily be kept.
  140. Of course the whole thing could be automated even
  141. more, taking on 50 find chunks (per web page) a time would
  142. probably fairly easy.
  143. On the other hand, leaving things only semi-automated
  144. allowed seeing a lot of what would probably be
  145. good to have seen before trying to automate even more.
  146. Some find pages pulled up a server error message when I tried to view them.
  147. Some had no mail link.
  148. Some seem to have had mangled email addresses as far as Lynx was concerned.
  149. Some pages had the mail link as the first link on the page,
  150. and so immediately started sending a resume.
  151.  
  152. By Saturday night, I estimate about 70 responses of various
  153. kinds had showed up.
  154. Some were mangled address results.
  155. Some were automated responses from the ad placers.
  156. Some were duplicate responses.
  157. Some the address no longer existed.
  158. Etc.
  159. A few seemed to actually be from people.  :-)
  160. Not too bad for a weekend.
  161.  
  162. As of this writing nothing definite, but the resume
  163. changes suggested by the local USENIX program manager are 
  164. will have an effect in the longrun.  
  165. The main thing is the resume is out there.
  166. All over, out there.
  167.  
  168. In order to bring this up to a mandatory buzzword content level,
  169. I thought of using the term 'Client Side Dynamic HTML' for the 
  170. idea.  The server provides it's normal content,
  171. but the client is able to carry out the wishes of the 
  172. user, not even having to wait for him to activate links.
  173. But the plain fact is that HTML was only peripherally
  174. involved in the process.  A more accurate discription is
  175. 'Automated client response'.  The various servers
  176. being interacted with are all 'automated', and this simply
  177. equalizes the other, client side of the equation with them some.
  178.  
  179. # *    <=  indicates comments added for this article
  180.  
  181. #     script for automating Dice.com resume submission
  182.  
  183.  
  184.  
  185. # * Start of the original Rexx script, here for documentation purposes
  186. # *
  187. #  #!/usr/local/bin/rexx
  188. #  /*          ReXX       */
  189. #  
  190. #  /*
  191. #  http://www.dice.com/mailto.cgi?xxxxxx@xxxxx.com&tttttt.EEE1111111191
  192. #  Subject: Job EEE1111 on DICE
  193. #   */
  194. #  
  195. #  
  196. #  PARSE ARG   URL '?'  eddress '&'  corpcode '.' jobid '&' somenumber  ;
  197. #  
  198. #  
  199. #  IF  'http://www.dice.com/mailto.cgi'  ><  URL  THEN
  200. #    DO
  201. #    SAY 'invalid URL ='URL'='  ;
  202. #    exit  ;
  203. #    END  ;
  204. #  
  205. #  
  206. #  /*   Testing stuff:
  207. #  SAY  "mailx -s 'Subject: Job "jobid" on DICE or any other appropriate job'  " ,
  208. #      ||  " "eddress" < /home/dallas/download/resume12x.txt  "
  209. #  'cat   /home/dallas/download/resume12x.txt  '
  210. #  
  211. #  For real:
  212. #  */
  213. #  
  214. #  SAY  "mailx -s 'Subject: Job "jobid" on DICE or any other appropriate job'  " ,
  215. #      ||  " "eddress" < /home/dallas/download/resume12x.txt  "
  216. #  
  217. #  EXIT  ;
  218.  
  219. # *  End of the Rexx script
  220.  
  221. # *  Listing of what Lynx queries on when processing a 'mailto:' link:
  222. #  
  223. #  
  224. #  You are sending a comment to:
  225. #    xxxx.xxxxx@xxxxxxxxxxxxxx.com
  226. #  
  227. #  Use Ctrl-G to cancel if you do not want to send a message
  228. #  
  229. #   Please enter your name, or leave it blank to remain anonymous
  230. #  Personal Name: Dallas E. Legan II
  231. #  
  232. #   Please enter a mail address or some other
  233. #   means to contact you, if you desire a response.
  234. #   Use Control-U to erase the default.
  235. #  From: xxxxxxx@xxxxxxx.com
  236. #  
  237. #   Please enter a subject line.
  238. #   Use Control-U to erase the default.
  239. #  Subject: Job MMMM_CCCC_Mrr. on DICE
  240. #  
  241. #   Enter a mail address for a CC of your message.
  242. #   Use Control-U to erase the default.
  243. #   (Leave blank if you don't want a copy.)
  244. #  Cc: xxxxxxx@xxxxxxx.com
  245. #  
  246.  
  247. # *  End of Lynx console interactions for 'mailto:'s
  248.  
  249. # *  Real start of the Kermit script:
  250.  
  251. :recycle
  252.  
  253. clear input-buffer
  254. #  set terminal trigger {Using mailto:}
  255. #  set terminal trigger {www\.dice\.com/mailto\.cgi}
  256. #  set terminal trigger {www\.dice\.com/mailto\.cgi}
  257. #  set terminal trigger {http://www\.dice\.com/mailto\.cgi\?}
  258. #  set terminal trigger {www.dice.com/mailto.cgi}
  259. set terminal trigger {ailto.cgi}
  260. #   something, escape sequences or double 'mm' in string,
  261. #   seemed to through this trigger string off when
  262. #    'mailto.cgi'
  263.  
  264. # *  When working on final version of the script, went through
  265. # *  quite a few desperate tries at the trigger string
  266. # *  before realizing that Lynx was only sending a fragment
  267. # *  of the CGI script URL wrapped in ANSI terminal escape
  268. # *  escape sequences - just what was needed to change the displayed
  269. # *  URL on the status line.
  270. # *  Escaping the periods should normally never be needed.  
  271. # *  (Like I said, this script is presented warts and all! :-) )
  272.  
  273.  
  274. #    set terminal trigger {mailto.cgi}
  275.  
  276. connect
  277.  
  278. # *  -- Here is where the browsing session starts,
  279. # *     and when the trigger string is encountered,
  280. # *     it pops back 'up' to this Kermit command line 
  281. # *     session and this script resumes execution
  282.  
  283.  
  284. set terminal trigger
  285. #  -- turn off the trigger
  286.  
  287. if equal  {\v(trigger)} {}    end 0  
  288. else  output  \013
  289.  
  290. # *  -- If leaving the browsing session via 'C-\ c'
  291. # *     end this script, otherwise activate the link
  292. # *     that was under the cursor with a carriage return 
  293.  
  294. # * Normally, the 'input' commands, such as follow from here on out
  295. # * in this script, should be accompanied by 'if success ...' or
  296. # * 'if failure ...', taking appropriate actions to build a robust script.
  297. # * I skipped this on this project for several reasons:
  298. # * 1) I was in a hurry
  299. # * 2) The interacting entities, in this case, were two programs
  300. # *    running on my computer.  When these prompts come up,
  301. # *    the CGI script has already run and fed a 'mailto:' to the
  302. # *    local browser, and it is feeding these query prompts
  303. # *    locally, not over the net.  If there is a communication
  304. # *    foulup, it is indicative of a local problem.
  305. # * 3) The 15 seconds alloted for to wait for responses
  306. # *    in most cases was an eternity
  307. # *    compared with how fast things were actually happening.
  308. # *    If anything went wrong, I could just 'C-C' and abort the script,
  309. # *    and try over.  This never proved necessary after things were 
  310. # *    debugged.  The purpose of the 'input's are to wait for strings
  311. # *    from Lynx to the 'console' (really Kermit in this case,
  312. # *    through the pseudo-terminal connecting them) 
  313. # *    to keep the commands Lynx is *given* synchronized
  314. # *    with what it is in a state to receive and act on.
  315. # *
  316. # * Anyway, these checks would probably be a good thing to add before
  317. # * moving to higher levels of automation.
  318.  
  319. input 15 {Personal Name:}
  320. pause 1
  321. output  \021Dallas E. Legan II\013
  322.  
  323.  
  324. #  input 15 {From: xxxxxxx@xxxxxxx.com}
  325. input 15 {From:}
  326. input 15 {xxxxxxx.com}
  327. output \13
  328.  
  329. input 15 {Subject:}
  330. input 15 {on DICE}
  331. output {\ or any position\13}
  332.  
  333. input 15 {Cc}
  334. #  input 15 {com}
  335. #  temp to test:  output \021\013
  336. output \021\013
  337. #  output \013
  338.  
  339. #  Do you wish to include the original message? (y/n)
  340.  
  341. input 15 {(y/n)}
  342. output n
  343.  
  344. # *  verify that vi is started up:
  345. input 15 {~}
  346. pause 1
  347.  
  348.  
  349. # *  The next few commands, 'output ....\13' 
  350. # * can be replaced with simply 'lineout ....' :
  351.  
  352. output {:read /home/dallas/download/resume12x.txt\13}
  353. #  pause 2
  354. pause 1
  355.  
  356. output {:wq\!\013}
  357.  
  358. #  Send this comment? (y/n)
  359.  
  360. input 15 {(y/n)}
  361. output y
  362.  
  363. #  Append '/home/dallas/.lynxsig'? (y/n)
  364.  
  365. input 15 {(y/n)}
  366. output y
  367.  
  368. input 1 qqq
  369. #   pause 5
  370. # *    clearing Lynx/pty to accept a command, with an unlikely string
  371.  
  372. output  \005
  373. #   --  move to the end of the web page
  374. # *      with C-E
  375.  
  376. input 1 qqq
  377. #   pause 1
  378.  
  379. output \012
  380. #   -- resetting the console
  381. # *     with C-L
  382.  
  383. goto recycle
  384.  
  385.  
  386. # *     End of the script
  387.  
  388. Regards,
  389. Dallas E. Legan II  /  leganii@surfree.com  /  dallasii@kincyb.com
  390.  
  391. Powered by......Lynx, the Internet at hyperkinetic speed.
  392.